package nongchang.kuaijiecaifu.com.ncapp_android.ui;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import butterknife.BindView;
import butterknife.ButterKnife;
import ezy.widget.adapter.TabsAdapter;
import nongchang.kuaijiecaifu.com.ncapp_android.R;
import nongchang.kuaijiecaifu.com.ncapp_android.common.activity.BaseActivity;

public class WholesaleActivity extends BaseActivity {
    @BindView(R.id.orderby)
    TabLayout mTabOrderBy;
    @BindView(R.id.pager)
    ViewPager mViewPager;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_wholesale);
        setupToolbarWithHome(R.id.toolbar);
        ButterKnife.bind(this);


        mTabOrderBy.addTab(mTabOrderBy.newTab().setText("商品"), true);
        mTabOrderBy.addTab(mTabOrderBy.newTab().setText("详情"));
        mTabOrderBy.addTab(mTabOrderBy.newTab().setText("评价"));
        mTabOrderBy.setOnTabSelectedListener(onTabSelectedListener);
        mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabOrderBy));
    }
    TabLayout.OnTabSelectedListener onTabSelectedListener = new TabLayout.OnTabSelectedListener() {
        @Override
        public void onTabSelected(TabLayout.Tab tab) {
            mViewPager.setCurrentItem(tab.getPosition());
        }

        @Override
        public void onTabUnselected(TabLayout.Tab tab) {

        }

        @Override
        public void onTabReselected(TabLayout.Tab tab) {

        }
    };
}
